//package com.yksj.healthtalk.ui.doctorstation;
//
//
//import org.universalimageloader.core.DefaultConfigurationFactory;
//import org.universalimageloader.core.DisplayImageOptions;
//import org.universalimageloader.core.ImageLoader;
//
//import android.content.BroadcastReceiver;
//import android.content.Context;
//import android.content.Intent;
//import android.content.IntentFilter;
//import android.graphics.Color;
//import android.os.AsyncTask;
//import android.os.Bundle;
//import android.util.TypedValue;
//import android.view.LayoutInflater;
//import android.view.View;
//import android.view.View.OnClickListener;
//import android.view.ViewGroup;
//import android.view.animation.Animation;
//import android.view.animation.AnimationUtils;
//import android.widget.ImageView;
//import android.widget.TextView;
//
//import com.yksj.healthtalk.comm.InstructionsDialogFragment;
//import com.yksj.healthtalk.comm.RootFragment;
//import com.yksj.healthtalk.comm.SingleBtnFragmentDialog;
//import com.yksj.healthtalk.net.http.AsyncHttpResponseHandler;
//import com.yksj.healthtalk.net.http.HttpRestClient;
//import com.yksj.healthtalk.net.socket.SmartFoxClient;
//import com.yksj.healthtalk.services.MessagePushService;
//import com.yksj.healthtalk.ui.R;
//import com.yksj.healthtalk.ui.app.HTalkApplication;
//import com.yksj.healthtalk.ui.buyandsell.BuyAndSellMainActivity;
//import com.yksj.healthtalk.ui.chatting.ChatLatelyListActivity;
//import com.yksj.healthtalk.ui.doctorstation.active.ActivesListActivity;
//import com.yksj.healthtalk.ui.doctorstation.service.DoctorQuerySubscribeServiceActivity;
//import com.yksj.healthtalk.ui.friend.DoctorInfoUIActivity;
//import com.yksj.healthtalk.ui.messageleave.DoctorMessageBoardDoctor;
//import com.yksj.healthtalk.ui.salon.SalonAboutOthersActivity;
//import com.yksj.healthtalk.utils.SharePreUtils;
//import com.yksj.healthtalk.utils.ToastUtil;
//
///**
// * 
// * 医生工作台(废弃)
// * @author zhao
// *
// */
//public class DoctorStationMainFragment extends RootFragment implements OnClickListener{
//	private TextView mLeaveMessage;
//	private Animation mSoundAnimation;
//	
//	final BroadcastReceiver receiver = new BroadcastReceiver(){
//		@Override
//		public void onReceive(Context context, Intent intent) {
//			String action = intent.getAction();
//			if (action.equals(MessagePushService.ACTION_MESSAGE)) {
//				new MesgQueryTask().execute();
//			}else if(action.equals(MessagePushService.ACTION_LEAVE_WORD)){
//				if(mLeaveMessage != null){
//					mLeaveMessage.setText("您有"+intent.getStringExtra(MessagePushService.BROAD_KEY)+"条未读留言");
//				}
//			}
//		}
//	};
//
//	private class MesgQueryTask extends AsyncTask<Void, Integer, Integer> {
//		@Override
//		protected Integer doInBackground(Void... params) {
//			int size = HTalkApplication.getNoReadMesgSize();
//			return size;
//		}
//		@Override
//		protected void onPostExecute(Integer result) {
//			if (result.intValue() == 0) {
//				mSoundAnimation.cancel();
//				titleLeftBtn.setText("消息");
//			} else {
//				mSoundAnimation.start();
//				if(result.intValue() > 99){
//					titleLeftBtn.setText(result.intValue() + "+新消息");
//				}else{
//					titleLeftBtn.setText(result.intValue() + "新消息");
//				}
//			}
//		}
//	}
//	
//	@Override
//	public void onCreate(Bundle savedInstanceState) {
//		super.onCreate(savedInstanceState);
//		InstructionsDialogFragment.show(6,getFragmentManager());
//	}
//	
//	@Override
//	public View onCreateView(LayoutInflater inflater, ViewGroup container,
//			Bundle savedInstanceState) {
//		View view =  inflater.inflate(R.layout.doctor_station_main_ui, null);
//		initView(view);
//		queryDataCount();
//		return view;
//	}
//	
//	private void queryDataCount(){
//		
//		//获取公告板未读条数
//		HttpRestClient.doHttpMessageLeaveCount(new AsyncHttpResponseHandler(){
//			@Override
//			public void onSuccess(String content) {
//				super.onSuccess(content);
//				try {
//					int count=Integer.valueOf(content);
//					if(count>0){
//						mLeaveMessage.setText("您有"+content+"条未读留言。");
//					}else{
//						mLeaveMessage.setText("公告板");
//					}
//				} catch (Exception e) {
//				}
//			}
//		});
//	}
//	
//	@Override
//	public void onClick(View v) {
//		Intent intent = null;
//		switch (v.getId()) {
//		case R.id.title_back:
////			onBackPressed(v);
//			intent = new Intent(getActivity(),ChatLatelyListActivity.class);
//			startActivity(intent);
//			break;
//		case R.id.title_right2:
//			boolean lockState = SharePreUtils.fatchLockState();
//			SharePreUtils.updateLockState(!lockState);
//			if(!lockState){
//				ToastUtil.showBasicShortToast(getActivity(), "已设置为首页");
//				titleRightBtn2.setText("取消设首页");
//			}else{
//				titleRightBtn2.setText("设首页");
//				ToastUtil.showBasicShortToast(getActivity(), "取消设置为首页");
//
//			}
//			break;
//		case R.id.myzone_headphoto:
//			intent = new Intent(getActivity(),DoctorInfoUIActivity.class);
//			intent.putExtra("id",SmartFoxClient.getLoginUserId());
//			startActivity(intent);
//			break;
//		case R.id.doctor_calear://日历
//			intent = new Intent(getActivity(),DoctorQuerySubscribeServiceActivity.class);
//			startActivity(intent);
//			break;
//		case R.id.doctor_service_manager://服务管理
//			intent = new Intent(getActivity(),DoctorSettingActivity.class);
//			startActivity(intent);
//			break;
//		case R.id.doctor_client_manager://患者管理
//			intent = new Intent(getActivity(),PatientServiceMainFragmentList.class);
//			startActivity(intent);
//			break;
//		case R.id.doctor_biji_button://病案管理
//			SingleBtnFragmentDialog.show(getChildFragmentManager(),"","病案管理即将开通","知道了");
//			break;
//		case R.id.doctor_salon://主题沙龙
//			intent =new Intent(getActivity(),SalonAboutOthersActivity.class);
//			intent.putExtra("type", "0");
//			startActivity(intent);
//			break;
//		case R.id.doctor_zhinan://医生指南
//			intent = new Intent(getActivity(),DocotrStationHelperActivity.class);
//			intent.putExtra("type","0");
//			//www.baidu.com
////			intent.putExtra("url", "http://second-vision.mobi/JumpPage/JumpPageServlet?Type=DoctorHelp");
////			intent.putExtra("title", "医生指南");
//			startActivity(intent);
//			break;
//		case R.id.doctor_zhushou://健康城
//			onBackPressed(v);
//			break;
//		case R.id.doctor_buy_sell:
//			intent =new Intent(getActivity(),BuyAndSellMainActivity.class);
//			intent.putExtra("type", false);
//			intent.putExtra("title","收入统计");
//			startActivity(intent);
//			break;
//		case R.id.leave_messgae_count:
//			intent = new Intent(getActivity(),DoctorMessageBoardDoctor.class);
//			startActivity(intent);
//			mLeaveMessage.setText("公告板");
//			break;
//		case R.id.doctor_actives://参加活动
//			intent = new Intent(getActivity(),ActivesListActivity.class);
//			startActivity(intent);
//			break;
//		}
//		
//	}
//	
//	private void initView(View view) {
//		initTitleView(view);
//		titleTextV.setText("我的诊所");
//		titleLeftBtn.setBackgroundDrawable(null);
//		titleLeftBtn.setText("消息");
//		titleLeftBtn.setTextColor(Color.WHITE);
//		titleLeftBtn.setOnClickListener(this);
//		titleRightBtn2.setVisibility(View.VISIBLE);
//		titleRightBtn2.setText("设首页");
//		titleRightBtn2.setOnClickListener(this);
//		
////		float textSize = getResources().getDimension(R.dimen.docotrStation);
//		titleLeftBtn.setTextSize(TypedValue.COMPLEX_UNIT_SP,17);
//		titleRightBtn2.setTextSize(TypedValue.COMPLEX_UNIT_SP,17);
//		
//		view.findViewById(R.id.doctor_calear).setOnClickListener(this);
//		view.findViewById(R.id.doctor_service_manager).setOnClickListener(this);
//		view.findViewById(R.id.doctor_client_manager).setOnClickListener(this);
//		view.findViewById(R.id.doctor_biji_button).setOnClickListener(this);
//		view.findViewById(R.id.doctor_salon).setOnClickListener(this);
//		view.findViewById(R.id.doctor_buy_sell).setOnClickListener(this);
//		view.findViewById(R.id.doctor_zhinan).setOnClickListener(this);//参加活动
//		view.findViewById(R.id.doctor_actives).setOnClickListener(this);
//		view.findViewById(R.id.doctor_zhushou).setOnClickListener(this);
//		
//		mLeaveMessage = (TextView)view.findViewById(R.id.leave_messgae_count);
//		mLeaveMessage.setOnClickListener(this);
//		ImageView imageView= (ImageView) view.findViewById(R.id.myzone_headphoto);
//		imageView.setOnClickListener(this);
//		ImageLoader loader = ImageLoader.getInstance();
//		DisplayImageOptions imageOptions = DefaultConfigurationFactory.createSexHeaderDisplayImageOptions(SmartFoxClient.getLoginUserInfo().getSex(), getActivity());
//		loader.displayImage(SmartFoxClient.getLoginUserInfo().getNormalHeadIcon(), imageView, imageOptions);
//		if(SharePreUtils.fatchLockState()){
//			titleRightBtn2.setText("取消设首页");
//		}else{
//			titleRightBtn2.setText("设首页");
//		}
//		titleLeftBtn.setTextColor(Color.WHITE);
//		titleRightBtn2.setTextColor(Color.WHITE);
//		mSoundAnimation = AnimationUtils.loadAnimation(getActivity(),R.anim.horn_anim);
//		titleLeftBtn.setAnimation(mSoundAnimation);
//	}
//	@Override
//	public void onStart() {
//		IntentFilter filter = new IntentFilter();
//		filter.addAction(MessagePushService.ACTION_MESSAGE);
//		filter.addAction(MessagePushService.ACTION_LEAVE_WORD);
//		getActivity().registerReceiver(receiver, filter);
//		super.onStart();
//		new MesgQueryTask().execute();
//	}
//	
//
//	@Override
//	public void onStop() {
//		getActivity().unregisterReceiver(receiver);
//		super.onStop();
//		
//		if(mSoundAnimation.hasStarted()){
//			mSoundAnimation.cancel();
//		}
//	}
//}
//	/*class MesgQuery extends AsyncTask<Void, Integer, Boolean> {
//		@Override
//		protected Boolean doInBackground(Void... params) {
//			return !HTalkApplication.getAppData().messageCllection.isEmpty();
//		}
//		@Override
//		protected void onPostExecute(Boolean result) {
//			if (mSoundAnimation != null && result) {
//				mSoundAnimation.start();
//			} else {
//				mSoundAnimation.cancel();
//			}
//		}
//	}*/
//	
//
